Skip to content

[SNOW-3249917] JDBC removal Step 11a: Replicate RestRequest and HTTP retry infrastructure#1142

Closed
sfc-gh-ggeng wants to merge 5 commits intojdbc-removal-step10c-remove-session-part2from
jdbc-removal-step11a-replicate-http
Closed

[SNOW-3249917] JDBC removal Step 11a: Replicate RestRequest and HTTP retry infrastructure#1142
sfc-gh-ggeng wants to merge 5 commits intojdbc-removal-step10c-remove-session-part2from
jdbc-removal-step11a-replicate-http

Conversation

@sfc-gh-ggeng
Copy link
Copy Markdown
Contributor

Summary

Verbatim replication of JDBC HTTP retry infrastructure (~3100 lines):

  • RestRequest (1265 lines) — HTTP request execution with retry logic
  • HttpExecutingContext (306 lines) — HTTP request execution state
  • HttpExecutingContextBuilder (280 lines) — builder for HttpExecutingContext
  • RetryContextManager (86 lines) — retry callback registration
  • RetryContext (41 lines) — retry state holder
  • DecorrelatedJitterBackoff (33 lines) — jitter backoff algorithm
  • URLUtil (74 lines) — URL validation and request ID extraction
  • SFOCSPException (36 lines) — OCSP exception
  • OCSPErrorCode (20 lines) — OCSP error code enum
  • ThrowingBiFunction (9 lines) — functional interface
  • SnowflakeUseDPoPNonceException (17 lines) — DPoP nonce exception

Remaining JDBC FQN references (to be resolved when HttpUtil is replicated):

  • net.snowflake.client.core.HttpUtil — 4 call sites in RestRequest
  • net.snowflake.client.core.SessionUtil.isNewRetryStrategyRequest — 1 call site

Test plan

  • mvn compiler:compile passes
  • CI passes

🤖 Generated with Claude Code

sfc-gh-ggeng and others added 2 commits April 2, 2026 23:11
Step 10c/10c2 done (remove SFSession). After those, 6 JDBC imports +
~70 FQN references remain. Split final cleanup into Step 11:

- 11a: Create HttpRequestHelper, replace 6 JDBC HTTP calls
- 11b: Remove 47 FQN SnowflakeSQLException from throws clauses
- 11c: Clean up remaining FQN refs (HttpClientSettingsKey, HttpProtocol,
  OCSPMode, SnowflakeUtil, setSessionlessProxyForAzure, AwsSdkGCPSigner)
- 11d: Demote JDBC to test scope + remove shade rules

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…retry infrastructure

Replicate the following JDBC classes (v3.25.1) verbatim into the ingest
fileTransferAgent package:

- ThrowingBiFunction (functional interface for retry callbacks)
- OCSPErrorCode (OCSP error code enum)
- SFOCSPException (OCSP exception)
- URLUtil (URL validation and request ID extraction)
- DecorrelatedJitterBackoff (already existed, now tracked)
- RetryContext (retry state holder)
- RetryContextManager (retry callback registration)
- HttpExecutingContext (HTTP request execution state)
- HttpExecutingContextBuilder (builder for HttpExecutingContext)
- SnowflakeUseDPoPNonceException (DPoP nonce error)
- RestRequest (1265-line HTTP request retry engine)

Import swaps applied per the JDBC removal plan. HttpUtil references kept
as FQN (net.snowflake.client.core.HttpUtil) pending future replication.
SessionUtil.isNewRetryStrategyRequest kept as FQN. SnowflakeUtil.logResponseDetails
inlined as a local method since it requires JDBC's SFLogger type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sfc-gh-ggeng sfc-gh-ggeng requested review from a team as code owners April 3, 2026 00:28
sfc-gh-ggeng and others added 3 commits April 3, 2026 00:51
…ap callers to replicated REST infrastructure

Replicate JDBC's HttpUtil as JdbcHttpUtil (renamed to avoid collision with
ingest's existing net.snowflake.ingest.utils.HttpUtil). Also replicate
SnowflakeMutableProxyRoutePlanner and AttributeEnhancingHttpRequestRetryHandler
as small helper classes.

Key changes:
- JdbcHttpUtil: verbatim replication of JDBC HttpUtil with import swaps.
  SFTrustManager replaced with null (ingest does not use OCSP trust manager).
  SFSSLConnectionSocketFactory -> IngestSSLConnectionSocketFactory.
  SystemUtil.convertSystemPropertyToIntValue inlined.
  SessionUtil.isNewRetryStrategyRequest inlined as static method.
  Deprecated S3 proxy wrapper methods omitted (S3HttpUtil callable directly).

- RestRequest: all FQN net.snowflake.client.core.HttpUtil references replaced
  with JdbcHttpUtil. SessionUtil.isNewRetryStrategyRequest replaced with
  JdbcHttpUtil.isNewRetryStrategyRequest.

- TelemetryClient: HttpUtil.executeGeneralRequest and HttpUtil.getSocketTimeout
  replaced with JdbcHttpUtil equivalents. SnowflakeSQLException import swapped
  to ingest's replicated version.

- SnowflakeGCSClient: HttpUtil.getHttpClient, getHttpClientWithoutDecompression,
  getSocketTimeout replaced with JdbcHttpUtil equivalents. Added toIngestKey
  adapter to convert JDBC's HttpClientSettingsKey during transition.

- SnowflakeAzureClient: setSessionlessProxyForAzure import swapped from JDBC
  HttpUtil to JdbcHttpUtil.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ap callers, clean up FQN refs

Replicate JDBC's HttpUtil as JdbcHttpUtil (renamed to avoid collision with
ingest's utils.HttpUtil). Swap all callers to use replicated REST
infrastructure. Clean up all FQN JDBC references.

New files:
- JdbcHttpUtil.java — verbatim replication of JDBC's HttpUtil
- SnowflakeMutableProxyRoutePlanner.java — proxy routing for HttpUtil
- AttributeEnhancingHttpRequestRetryHandler.java — headers customizer
- AwsSdkGCPSigner.java — GCS virtual-style access signer

Changes:
- RestRequest: swap HttpUtil FQN → JdbcHttpUtil
- TelemetryClient: swap HttpUtil → JdbcHttpUtil
- SnowflakeGCSClient: swap HttpUtil/RestRequest → JdbcHttpUtil/RestRequest
- SnowflakeAzureClient: swap setSessionlessProxyForAzure → JdbcHttpUtil
- StorageClientUtil: fix convertProxy exception type, fix throwNoSpaceLeft
- Remove all FQN SnowflakeSQLException from throws (~47 occurrences)
- Remove all FQN HttpClientSettingsKey/HttpProtocol/OCSPMode
- Swap AwsSdkGCPSigner to ingest version

Result: ZERO net.snowflake.client references in production code
(only comments documenting source URLs remain).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Change snowflake-jdbc-thin scope to test in pom.xml (used only by
  TestUtils.java for IT result verification)
- Remove JDBC shade relocation rules from Maven Shade plugin

JDBC is no longer shipped in the SDK jar. Zero net.snowflake.client
code references in production code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sfc-gh-ggeng
Copy link
Copy Markdown
Contributor Author

Split into 4 smaller PRs for easier review: #1143 (11a), #1144 (11a-p2), #1145 (11b), #1146 (11d).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant